# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchema do
  @moduledoc """
  Resource representing a policy schema.

  ## Attributes

  *   `accessRestrictions` (*type:* `list(String.t)`, *default:* `nil`) - Output only. Specific access restrictions related to this policy.
  *   `additionalTargetKeyNames` (*type:* `list(GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1AdditionalTargetKeyName.t)`, *default:* `nil`) - Output only. Additional key names that will be used to identify the target of the policy value. When specifying a `policyTargetKey`, each of the additional keys specified here will have to be included in the `additionalTargetKeys` map.
  *   `categoryTitle` (*type:* `String.t`, *default:* `nil`) - Title of the category in which a setting belongs.
  *   `definition` (*type:* `GoogleApi.ChromePolicy.V1.Model.Proto2FileDescriptorProto.t`, *default:* `nil`) - Schema definition using proto descriptor.
  *   `fieldDescriptions` (*type:* `list(GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription.t)`, *default:* `nil`) - Output only. Detailed description of each field that is part of the schema. Fields are suggested to be displayed by the ordering in this list, not by field number.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Format: name=customers/{customer}/policySchemas/{schema_namespace}
  *   `notices` (*type:* `list(GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaNoticeDescription.t)`, *default:* `nil`) - Output only. Special notice messages related to setting certain values in certain fields in the schema.
  *   `policyApiLifecycle` (*type:* `GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyApiLifecycle.t`, *default:* `nil`) - Output only. Current lifecycle information.
  *   `policyDescription` (*type:* `String.t`, *default:* `nil`) - Output only. Description about the policy schema for user consumption.
  *   `schemaName` (*type:* `String.t`, *default:* `nil`) - Output only. The fully qualified name of the policy schema. This value is used to fill the field `policy_schema` in PolicyValue when calling BatchInheritOrgUnitPolicies BatchModifyOrgUnitPolicies BatchModifyGroupPolicies or BatchDeleteGroupPolicies.
  *   `supportUri` (*type:* `String.t`, *default:* `nil`) - Output only. URI to related support article for this schema.
  *   `supportedPlatforms` (*type:* `list(String.t)`, *default:* `nil`) - Output only. List indicates that the policy will only apply to devices/users on these platforms.
  *   `validTargetResources` (*type:* `list(String.t)`, *default:* `nil`) - Output only. Information about applicable target resources for the policy.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :accessRestrictions => list(String.t()) | nil,
          :additionalTargetKeyNames =>
            list(
              GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1AdditionalTargetKeyName.t()
            )
            | nil,
          :categoryTitle => String.t() | nil,
          :definition => GoogleApi.ChromePolicy.V1.Model.Proto2FileDescriptorProto.t() | nil,
          :fieldDescriptions =>
            list(
              GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription.t()
            )
            | nil,
          :name => String.t() | nil,
          :notices =>
            list(
              GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaNoticeDescription.t()
            )
            | nil,
          :policyApiLifecycle =>
            GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyApiLifecycle.t()
            | nil,
          :policyDescription => String.t() | nil,
          :schemaName => String.t() | nil,
          :supportUri => String.t() | nil,
          :supportedPlatforms => list(String.t()) | nil,
          :validTargetResources => list(String.t()) | nil
        }

  field(:accessRestrictions, type: :list)

  field(:additionalTargetKeyNames,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1AdditionalTargetKeyName,
    type: :list
  )

  field(:categoryTitle)
  field(:definition, as: GoogleApi.ChromePolicy.V1.Model.Proto2FileDescriptorProto)

  field(:fieldDescriptions,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaFieldDescription,
    type: :list
  )

  field(:name)

  field(:notices,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchemaNoticeDescription,
    type: :list
  )

  field(:policyApiLifecycle,
    as: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicyApiLifecycle
  )

  field(:policyDescription)
  field(:schemaName)
  field(:supportUri)
  field(:supportedPlatforms, type: :list)
  field(:validTargetResources, type: :list)
end

defimpl Poison.Decoder,
  for: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchema do
  def decode(value, options) do
    GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchema.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ChromePolicy.V1.Model.GoogleChromePolicyVersionsV1PolicySchema do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
